<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">
        <el-col :span="6" :xs="24">
          <user-card
            :user="user"
          />
        </el-col>

        <el-col :span="18" :xs="24">
          <el-card>
            <account
              :user="user"
            />
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import UserCard from '@/views/profile/components/UserCard'
import Account from '@/views/profile/components/Account'

export default {
  name: 'Profile',
  components: { UserCard, Account },
  data() {
    return {
      user: {},
      activeTab: 'activity',
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'phone',
      'realName',
      'email',
      'status',
      'loginType',
      'role',
      'id'
    ])
  },
  created() {
    this.getUser()
  },
  methods: {
    getUser() {
      this.user = {
        name: this.name,
        email: this.email,
        avatar: this.avatar,
        phone: this.phone,
        realName: this.realName,
        status: this.status,
        loginType: this.loginType,
        role: this.role,
        id: this.id
      }
    }
  }
}
</script>
